package cn.enilu.flash.bean.entity.task;

import cn.enilu.flash.bean.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import java.math.BigDecimal;
import java.util.Date;

@Entity(name = "t_help_task")
@Table(appliesTo = "t_help_task", comment = "帮助任务")
@Data
@EntityListeners(AuditingEntityListener.class)
public class HelpTask extends BaseEntity {
    @Column(columnDefinition = "int(4) comment '分类id'")
    private Integer classifyId;

    @Column(columnDefinition = "varchar(32) comment '标题'")
    private String title;

    @Column(columnDefinition = "int(4) comment '任务数量'")
    private Integer num;

    @Column(columnDefinition = "int(4) comment '剩余任务数量'")
    private Integer lastNum;

    @Column(columnDefinition = "int(2) comment '状态:0待支付，1进行中，2审核中，3待修改，5已结束，6暂停中'")
    private Integer state;

    @Column(columnDefinition = "varchar(255) comment '任务简述'")
    private String sketch;

    @Column(columnDefinition = "decimal(8,2) COMMENT '单个任务服务费'")
    private BigDecimal serviceFee;

    @Column(columnDefinition = "decimal(8,2) COMMENT '任务单价'")
    private BigDecimal price;

    @Column(columnDefinition = "int(2) comment '完成时限（小时）'")
    private Integer timeLimit;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(columnDefinition = "DATETIME COMMENT '任务结束时间'")
    private Date endTime;

    @Column(columnDefinition = "int COMMENT '百度city_code'")
    private Integer cityId;

    @Column(columnDefinition = "varchar(255) COMMENT '审核不通过原因'")
    private String failureReason;
}
